<template>
  <div class="home-emty">
    <h1>启动</h1>
    <el-button @click="openDirFn" type="text">打开文件夹</el-button>
  </div>
</template>

<script setup lang="ts">
import useFileStore from '@/store/file';
const fileStore = useFileStore();

const { fileSend, fileOn } = window.electronApi;

const openDirFn = () => {
  fileSend({ type: 'getDir' })
}

// 监听通信
fileOn(function (event: any, message: any) {
  const { type, data } = message;
  switch (type) {
    case 'getDir':
      fileStore.updateDirPath(data);
      break;
    default:
      return false;
  }
})

</script>

<style lang="scss" scoped>
.home-emty {
  h1 {
    color: #fff;
  }
}
</style>